package com.dk.demo.core.service.strategy.impl;

import com.dk.demo.common.model.strategy.StrategyType;
import com.dk.demo.common.model.strategy.impl.AOutputDTO;
import com.dk.demo.common.model.strategy.impl.BInputDTO;
import com.dk.demo.common.model.strategy.impl.BOutputDTO;
import com.dk.demo.core.service.strategy.AbstractStrategy;
import org.springframework.stereotype.Component;

@Component
public class BStrategy extends AbstractStrategy <BInputDTO,BOutputDTO>{


    @Override
    public StrategyType type() {
        return StrategyType.MAX;
    }

    @Override
    public BOutputDTO exec(BInputDTO inputDTO) {
        BOutputDTO outputDTO = new BOutputDTO().setMax(Math.max(inputDTO.getA(),inputDTO.getB()));
        outputDTO.setResult(type().getDescription());
        return outputDTO;
    }
}
